Skip to main content

Working with Images

What is an Image?

In the context of digital technology and computing, images are represented as a grid of pixels, with each pixel containing information about color and intensity.

placeholderplaceholder
Ran in 0.00μs (Infinity ops/s)

Types of images supported by ImagesJS

  • Currently ImageJS supports images with these characteristics:
TIFFJPEGPNGBMP
Bits per channel8 or 16 bits8 bits8 or 16 bits1 bit
Alpha channelyesnoyesno
Lossy compressioncan be eitheryesnono
Color ModelRGB or grayscaleRGBRGB or grayscaleN/A
Can be loaded in this format
Can be saved in this format

Image coordinates

The origin point has coordinates (0,0) and is located in the top-left corner of an image.

Image coordinates

So, if we want to get a certain pixel on the image we will be counting the distance from image's top-left corner.

//We will receive 20th row and 10th column
//from the top-left corner.
const pixel = image.getPixel(10, 20);

Properties

In ImageJS main properties of an image are:

  • width

  • height

  • data: typed array with information about image's pixels.

  • Color model: the abstract model of how pixel colors are formed.

  • Bit depth: number of bits allocated to each channel.

  • Number of channels: number of color channels that each pixel has. Grey image has one, RGB-type of image has three.

  • Number of components: number of color channels that each pixel has but without alpha channel.

  • Alpha channel: channel that represents the transparency or opacity levels of pixels.

  • Metadata: data about data. A basic example would be date and time when an image was taken.

Features

Currently, there are several ways of processing an image:

  • Filtering: filters usually apply some sort of kernel to change an image.

  • Comparison: these features compare two images for further feature matching between the two.

  • Geometry: this part of ImageJS allows rotating and resizing an image.

  • Morphology: enables shape analysis and shape identification.

  • ROI analysis: these features allow targeting and extracting relevant information from specific regions of interest.